// Templates.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "MyTemplateClass.h"
#include <iostream>

using namespace std;


class MyInt
{
private:
	int n;

public:

	void Set( int _n ) { n = _n; }

	void Show( void ) { cout << n; }

	MyInt operator + ( MyInt &rhs )
	{
		MyInt newN;

		newN.n = this->n + rhs.n;

		return newN;
	}

friend MyInt operator - ( MyInt &lhs, MyInt &rhs );

};

MyInt operator - ( MyInt &lhs, MyInt &rhs )
{
	MyInt newN;

	newN.n = lhs.n - rhs.n;

	return newN;
}

template <typename T1, typename T2, typename T3 >
T3 Add( T1 a, T2 b )
{
	return a + b;
}

template <typename T1, typename T2, typename T3 >
T3 Minus( T1 a, T2 b )
{
	return a - b;
}







int _tmain(int argc, _TCHAR* argv[])
{
	/*cout << Add( 1.5f, 1.0f ) << endl;
	cout << Add( 1.5, 1.0 ) << endl;
	cout << Add( 1, 1 ) << endl;
	cout << Add( 'a', 'a' ) << endl;

	MyInt a, b;

	a.n = 10;
	b.n = 50;

	cout << Add( a, b ).n << endl;*/


	//cout << Add( 1.5f, 1 ) << endl;
	cout << Minus<float, int, double>( 1, 1.5f ) << endl;

	int integer = 10;
	MyTemplateClass<int> bla( integer );
	bla.Show();

	return 0;
}

